import request from "@/utils/request";

export default {
  getUserInfo(token) {
    return request({
      url: "/user/info",
      method: "get",
      params: { token },
    });
  },

  register(user) {
    return request({
      url: "/user/register",
      method: "post",
      data: user,
    });
  },

  updateUserTop(user) {
    return request({
      url: "/user/updateUserTop",
      method: "put",
      data: user,
    });
  },

  // 修改密码(password, uPassword)
  updatePassword(id, password, uPassword) {
    return request({
      url: "/user/updatePassword",
      method: "put",
      data: {
        id: id,
        password: password,
        uPassword: uPassword,
      },
    });
  },

  // 获取验证码图片
  getEmailCode(data) {
    return request({
      url: "/user/getEmailCode",
      method: "post",
      data: data,
    });
  },

  // 检测验证码舒服输入正确
  checkCodeIsOk(emailCode) {
    return request({
      url: "/user/checkCodeIsOk",
      method: "post",
      data: emailCode,
    });
  },

  // 忘记密码修改密码
  updatePasswordByEmailCode(data) {
    return request({
      url: "/user/updatePasswordByEmailCode",
      method: "put",
      data: data,
    });
  },
};
